package com.bonjour.work.controller.spi;


import org.springframework.stereotype.Component;

import com.bonjour.common.core.BaseService;
import com.bonjour.common.helper.ThreadFactoryHelper;

import javax.inject.Inject;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * @date 2019/12/5 20:08
 */
@Component
public class CronProcessor extends BaseService {
    private static final ScheduledExecutorService SES_MINUTE = Executors.newSingleThreadScheduledExecutor(ThreadFactoryHelper.threadFactoryOf("MINUTE"));
    private static final ScheduledExecutorService SES_DAY = Executors.newSingleThreadScheduledExecutor(ThreadFactoryHelper.threadFactoryOf("DAY"));

    @Inject
    public CronProcessor() {

    }

    public void starting() {

//        // 每5分钟执行
//        SES_MINUTE.scheduleAtFixedRate(() -> {
//            // TODO
//            //新增测评数据
//            LOG.debug("定时任务开始执行");
//            adminScoreService.insertEvaluaAll();
//        }, 5, 5 * DateHelper.MINUTE_TIME, TimeUnit.MILLISECONDS);
//
//
//        //每天凌晨0.00拉取数据
//        final long slot1 = DateHelper.timeSlot(DateHelper.minuteAt(0, 0), DateHelper.DAY_TIME);
//        // 每天0时执行
//        SES_DAY.scheduleAtFixedRate(() -> {
//            adminScoreService.activeCountRecord();
//            commonService.completionProjectPermissions();
//            commonService.completionScenePermissions();
//            commonService.makeUpUserInfo();
//        }, slot1, DateHelper.DAY_TIME, TimeUnit.MILLISECONDS);
//    }
    }
}
